package com.my.common.util.thread;

import java.util.concurrent.TimeUnit;

/**
 * 线程休眠帮助类
 *
 * @author: marshal
 * @date: 2023-06-28 20:27
 */
public class Sleeper {


    /**
     *  线程休眠指定秒
     *
     * @param i 秒
     */
    public static void sleep(int i) {
        try {
            TimeUnit.SECONDS.sleep(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void sleep(double i) {
        try {
            TimeUnit.MILLISECONDS.sleep((int) (i * 1000));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
